//
//  BNDBHelper.m
//  BeautifulNote
//
//  Created by 张冬冬 on 2019/7/22.
//  Copyright © 2019 Maker. All rights reserved.
//

#import "BNDBHelper.h"

@implementation BNDBHelper
+ (BOOL)saveToDBWithHomeModel:(BNHomeModel *)homeModel {
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [[NSNotificationCenter defaultCenter] postNotificationName:@"shouldReload" object:nil];
    });
    return [homeModel saveToDB];
}

+ (NSArray<BNHomeModel *> *)selectAllHomeModels {
    NSMutableArray* array = [BNHomeModel searchWithWhere:nil];
    return array;
}

+ (NSArray<BNHomeModel *> *)selectHomeModelsWithYear:(NSString *)year month:(NSString *)month {
    NSMutableArray* array = [BNHomeModel searchWithWhere:@{
                                                           @"year": year,
                                                           @"month": month
                                                           }];
    return array;
}

@end
